package com.fly.snailrun.base;

import com.fly.snailrun.base.constant.SystemEnvEnum;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author : gaoxu
 * @date : Created on 2020/5/7
 */
@Component
@Data
public class SystemConfig {

    @Value("${system.config.env:SIT}")
    private String env;

    @Value("${spring.application.name}")
    private String appName;

    public boolean isProductEnv() {
        return SystemEnvEnum.PRO == SystemEnvEnum.fromString(getEnv());
    }

    public boolean isDeveloperEnv() {
        return SystemEnvEnum.SIT == SystemEnvEnum.fromString(getEnv());
    }

    public boolean isDemoEnv() {
        return SystemEnvEnum.PRE == SystemEnvEnum.fromString(getEnv());
    }
}
